<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
		<title>微信布局</title>
		<link rel="icon" href="../img/favicon.ico"/>
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.css"/>
		<style type="text/css">
			*{
				margin: 0px;
				padding: 0px;
			}
			.container{
				border: 1px solid black;
				width:1330px;
			    height: 500px;
			}
			.main{
				text-align: center;
				font-size: 50px;
			}
			.box{
				border: 1px solid black;
				font-size: 20px;
				padding-top: 20px;
			}
			.box:hover{
				color: #419641;
			}
			
		</style>
	</head>
	<body>
			<div class="container">
				<div class="main">111</div>
				<div class="row footer text-center navbar-fixed-bottom">
					<div class="col-md-3 col-sm-3 col-xs-3 box item active">
						<span class="glyphicon glyphicon-home"></span>
						<p>微信</p>
					</div>
					<div class="col-md-3 col-sm-3 col-xs-3 box item">
						<span class="glyphicon glyphicon-phone"></span>
						<p>通讯录</p>
					</div>
					<div class="col-md-3 col-sm-3 col-xs-3 box item">
						<span class="glyphicon glyphicon-search"></span>
						<p>发现</p>
					</div>
					<div class="col-md-3 col-sm-3 col-xs-3 box item">
						<span class="glyphicon glyphicon-user"></span>
						<p>我</p>
					</div>
				</div>
			</div>
			<script src="../js/jquery-3.4.1.js"></script>
			<script src="../js/bootstrap.js"></script>
			<script>
			    function writeMain() {
			        let tabbar = $('.box')
			        tabbar.each((index, item) => {
			            console.log($(item).hasClass('active'))
			            if ($(item).hasClass('active')) {
			                $('.main').html($(item).find('p').html())
			            }
			        });
			    }
			
			    $(function() {
			        writeMain()
			        $('.box').click(function() {
			            let index = $(this).index()
			            $('.box').each(function(i, item) {
			                if (i === index) {
			                    $(item).addClass('active')
			                } else {
			                    $(item).removeClass('active')
			                }
			            });
			            writeMain();
			        });
			    });
			</script>
			   
	</body>
</html>
